ComponentOne Reports for WPF
Task Based Help / Customize Page Layout / Defining and Using Global Constants
In This Topic
    Defining and Using Global Constants
    In This Topic

    There is no special mechanism for defining and using global constants in a report, but you can add hidden fields to the report and use their values as global parameters. To do this, complete the following steps:

    1. Open the C1ReportDesigner application. For more information on how to access C1ReportDesigner, see Accessing C1ReportDesigner from Visual Studio.
    2. Create a new report|tag=Creating a Basic Report Definition or open an existing report. Once you have the report in the C1ReportDesigner application, you can modify the report properties.
    3. Click the Close Print Preview button to begin editing the report.
    4. In the Fields group of the Design tab, click the Add Label button to add a field to your report.
    5. Click on your report where you want the field placed and drag to resize the field.
    6. Set the following properties for the field:

    Property

    Setting

    Field.Name

    linesPerPage

    Field.Text

    14

    Field.Visible

    False

    1. To control the number of detail lines per page, use script. Select Detail from the drop-down list above the Properties window.
    2. Locate the C1.C1Report.Section.OnPrint property and click the empty field next to it, and then click the ellipsis button.

    The VBScript Editor appears.

    1. Enter the following VBScript expression in the code editor:

    cnt = cnt + 1

    detail.forcepagebreak = "none"

    if cnt >= linesPerPage then

      cnt = 0

      detail.forcepagebreak = "after"

    endif

    Note that the value in the linesPerPage field can be set prior to rendering the report, by changing the field's Text property.

    Sample Report Available:

    For the complete report, see report "08: Global Constant" in the CommonTasks.xml report definition file, which is available for download from the CommonTasks sample on the ComponentOne HelpCentral Sample page.

    See Also